﻿@model Dictionary<string, int>
@{
    // Receive Parameter
    int appPrcId = Model["AppPrcId"];
    int refId = Model["RefId"];
    int Related = Model.ContainsKey("Related") ? Model["Related"] : 0;
    
    // Initial
    string url = null;
    ApproveProcess appPrc;
    
    // Load Object
    var db = new GERPContext(true);
    appPrc = db.ApproveProcesses.Include("ApproveProcessGroup").FirstOrDefault(o => o.AppPrcId == appPrcId);
    if(appPrc == null || appPrc.ApproveProcessGroup == null)
    {
        throw new Exception("ประเภทคำขอไม่ถูกต้อง");
    }
    
    ViewBag.appPrc = appPrc;
    ViewBag.refId = refId; 
    ViewBag.Related = Related;
}
 
@Html.Partial("~/Views/Task/_GetViewBagUrl.cshtml")
@{
    url = "" + Session["Url1"];
}
@if(!string.IsNullOrWhiteSpace(url))
{
    <h4 class="header bigger lighter blue" style="margin-bottom: 0px;">
        ข้อมูลที่เกี่ยวข้องของ@(appPrc.Name)
        @if(!string.IsNullOrWhiteSpace(url))
        {
            @:&nbsp;&nbsp;
            <a href="@url.Replace("nolayout=True", "")" target="_blank">
                (เปิดในหน้าต่างใหม่ <i class="icon-external-link"></i>)
            </a>
        } 
    </h4>
    <iframe id="iframe1" src="@url" style="width: 100%; border: none;"></iframe>
} 